/*
var spawn = require('child_process').spawn;

spawn('prg', [], {stdio: ['pipe', 'pipe', process.stderr]});
*/

var cp = require('child_process');

var sp1 = cp.spawn('node', ['test1.js', 'one', 'two', 'three']);

var sp2 = cp.spawn('node', ['test2.js'], {stdio: 'pipe'});

sp1.stdout.on('data', function(data){
	console.log("子进程标准输出：" + data);
	sp2.stdin.write(data);
});

sp1.on('exit', function(code, signal){
	console.log("子进程退出，退出代码：" + code);
	process.exit();
});